import { createStore } from 'vuex'
import axios from "axios";

export default createStore({
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
  }
})

export function downloadFile(url, method, params) {
  axios({
    method: method,//请求方式
    url: url,
    responseType: 'blob',
    data: params //需要传的字段
  }).then((res) => {
    let blob = new Blob([res.data], {
      type: `application/pdf` //word文档为msword,pdf文档为pdf
    });
    let objectUrl = URL.createObjectURL(blob);
    let link = document.createElement("a");
    let fname = `质量方针合格证`; //下载文件的名字
    link.href = objectUrl;
    link.setAttribute("download", fname);
    document.body.appendChild(link);
    link.click();
  })

}



